import {ElMessage, ElMessageBox, ElNotification} from "element-plus"
// 提示
export const message = (type: string, message: string) => {
    ElMessage({
        // @ts-expect-error 禁止飘红
        message,
        type,
        plain: true,
        duration: 2500,
        offset: 90,
    })
}
// 通知
export const notification = (title: string, message: string, type: string) => {
    ElNotification({
        //@ts-expect-error 禁止飘红
        title,
        message,
        type,
        duration: 3000,
        showClose: false,
    })
}
// 确认弹窗
export const messageBox = async (
    title: string,
    content: string,
    type: string = 'primary',
    options?: any
) => {
    await new Promise((resolve, reject) => {
        ElMessageBox.confirm(content, title, {
            type,
            ...options,
        }).then(() => {
            resolve("ok")
        }).catch(() => {
            reject("用户点击取消！")
        })
    })
}
